import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import request from 'utils/request';
import { CPAAS_PLATFORM } from 'utils/config';
import { parseParameter } from 'utils/utils'; // 配置维护

/**
 * 查询列表
 * @returns {Promise<Object>}
 */

export function profileSiteQueryPage(_x) {
  return _profileSiteQueryPage.apply(this, arguments);
}
/**
 * 删除配置头
 * @returns {Promise<Object>}
 */

function _profileSiteQueryPage() {
  _profileSiteQueryPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
    var query;
    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            query = parseParameter(params);
            return _context.abrupt("return", request("".concat(CPAAS_PLATFORM, "/v1/profiles"), {
              method: 'GET',
              query: query
            }));

          case 2:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));
  return _profileSiteQueryPage.apply(this, arguments);
}

export function profileSiteRemoveOne(_x2) {
  return _profileSiteRemoveOne.apply(this, arguments);
}
/**
 * 查询配置头行
 * @returns {Promise<Object>}
 */

function _profileSiteRemoveOne() {
  _profileSiteRemoveOne = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(params) {
    return _regeneratorRuntime.wrap(function _callee2$(_context2) {
      while (1) {
        switch (_context2.prev = _context2.next) {
          case 0:
            return _context2.abrupt("return", request("".concat(CPAAS_PLATFORM, "/v1/profiles"), {
              method: 'DELETE',
              body: params
            }));

          case 1:
          case "end":
            return _context2.stop();
        }
      }
    }, _callee2);
  }));
  return _profileSiteRemoveOne.apply(this, arguments);
}

export function profileSiteQueryProfileValue(_x3) {
  return _profileSiteQueryProfileValue.apply(this, arguments);
}
/**
 * 删除配置行
 * @returns {Promise<Object>}
 */

function _profileSiteQueryProfileValue() {
  _profileSiteQueryProfileValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(profileId) {
    return _regeneratorRuntime.wrap(function _callee3$(_context3) {
      while (1) {
        switch (_context3.prev = _context3.next) {
          case 0:
            return _context3.abrupt("return", request("".concat(CPAAS_PLATFORM, "/v1/profiles/").concat(profileId), {
              method: 'GET'
            }));

          case 1:
          case "end":
            return _context3.stop();
        }
      }
    }, _callee3);
  }));
  return _profileSiteQueryProfileValue.apply(this, arguments);
}

export function profileValueSiteRemoveOne(_x4) {
  return _profileValueSiteRemoveOne.apply(this, arguments);
}
/**
 * 保存配置 头行
 * @returns {Promise<Object>}
 */

function _profileValueSiteRemoveOne() {
  _profileValueSiteRemoveOne = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(params) {
    return _regeneratorRuntime.wrap(function _callee4$(_context4) {
      while (1) {
        switch (_context4.prev = _context4.next) {
          case 0:
            return _context4.abrupt("return", request("".concat(CPAAS_PLATFORM, "/v1/profiles-value"), {
              method: 'DELETE',
              body: params
            }));

          case 1:
          case "end":
            return _context4.stop();
        }
      }
    }, _callee4);
  }));
  return _profileValueSiteRemoveOne.apply(this, arguments);
}

export function profileSiteSaveOne(_x5) {
  return _profileSiteSaveOne.apply(this, arguments);
} // 租户级

/**
 * 查询列表
 * @returns {Promise<Object>}
 */

function _profileSiteSaveOne() {
  _profileSiteSaveOne = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(profile) {
    return _regeneratorRuntime.wrap(function _callee5$(_context5) {
      while (1) {
        switch (_context5.prev = _context5.next) {
          case 0:
            return _context5.abrupt("return", request("".concat(CPAAS_PLATFORM, "/v1/profiles"), {
              method: 'POST',
              body: profile
            }));

          case 1:
          case "end":
            return _context5.stop();
        }
      }
    }, _callee5);
  }));
  return _profileSiteSaveOne.apply(this, arguments);
}

export function profileOrgQueryPage(_x6, _x7) {
  return _profileOrgQueryPage.apply(this, arguments);
}
/**
 * 删除配置头
 * @returns {Promise<Object>}
 */

function _profileOrgQueryPage() {
  _profileOrgQueryPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(organizationId, params) {
    var query;
    return _regeneratorRuntime.wrap(function _callee6$(_context6) {
      while (1) {
        switch (_context6.prev = _context6.next) {
          case 0:
            query = parseParameter(params);
            return _context6.abrupt("return", request("".concat(CPAAS_PLATFORM, "/v1/").concat(organizationId, "/profiles"), {
              method: 'GET',
              query: query
            }));

          case 2:
          case "end":
            return _context6.stop();
        }
      }
    }, _callee6);
  }));
  return _profileOrgQueryPage.apply(this, arguments);
}

export function profileOrgRemoveOne(_x8, _x9) {
  return _profileOrgRemoveOne.apply(this, arguments);
}
/**
 * 查询配置头行
 * @returns {Promise<Object>}
 */

function _profileOrgRemoveOne() {
  _profileOrgRemoveOne = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(organizationId, profile) {
    return _regeneratorRuntime.wrap(function _callee7$(_context7) {
      while (1) {
        switch (_context7.prev = _context7.next) {
          case 0:
            return _context7.abrupt("return", request("".concat(CPAAS_PLATFORM, "/v1/").concat(organizationId, "/profiles"), {
              method: 'DELETE',
              body: profile
            }));

          case 1:
          case "end":
            return _context7.stop();
        }
      }
    }, _callee7);
  }));
  return _profileOrgRemoveOne.apply(this, arguments);
}

export function profileOrgQueryProfileValue(_x10, _x11) {
  return _profileOrgQueryProfileValue.apply(this, arguments);
}
/**
 * 删除配置行
 * @returns {Promise<Object>}
 */

function _profileOrgQueryProfileValue() {
  _profileOrgQueryProfileValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(organizationId, profileId) {
    return _regeneratorRuntime.wrap(function _callee8$(_context8) {
      while (1) {
        switch (_context8.prev = _context8.next) {
          case 0:
            return _context8.abrupt("return", request("".concat(CPAAS_PLATFORM, "/v1/").concat(organizationId, "/profiles/").concat(profileId), {
              method: 'GET'
            }));

          case 1:
          case "end":
            return _context8.stop();
        }
      }
    }, _callee8);
  }));
  return _profileOrgQueryProfileValue.apply(this, arguments);
}

export function profileValueOrgRemoveOne(_x12, _x13) {
  return _profileValueOrgRemoveOne.apply(this, arguments);
}
/**
 * 保存配置 头行
 * @returns {Promise<Object>}
 */

function _profileValueOrgRemoveOne() {
  _profileValueOrgRemoveOne = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(organizationId, params) {
    return _regeneratorRuntime.wrap(function _callee9$(_context9) {
      while (1) {
        switch (_context9.prev = _context9.next) {
          case 0:
            return _context9.abrupt("return", request("".concat(CPAAS_PLATFORM, "/v1/").concat(organizationId, "/profiles-value"), {
              method: 'DELETE',
              body: params
            }));

          case 1:
          case "end":
            return _context9.stop();
        }
      }
    }, _callee9);
  }));
  return _profileValueOrgRemoveOne.apply(this, arguments);
}

export function profileOrgSaveOne(_x14, _x15) {
  return _profileOrgSaveOne.apply(this, arguments);
}

function _profileOrgSaveOne() {
  _profileOrgSaveOne = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(organizationId, profile) {
    return _regeneratorRuntime.wrap(function _callee10$(_context10) {
      while (1) {
        switch (_context10.prev = _context10.next) {
          case 0:
            return _context10.abrupt("return", request("".concat(CPAAS_PLATFORM, "/v1/").concat(organizationId, "/profiles"), {
              method: 'POST',
              body: profile
            }));

          case 1:
          case "end":
            return _context10.stop();
        }
      }
    }, _callee10);
  }));
  return _profileOrgSaveOne.apply(this, arguments);
}